# -*- coding:utf-8 -*-
from django.conf.urls.defaults import *


urlpatterns = patterns('',
    ('^$', 'ktit.storage.views.main.index'),
    (r'^category/(\d+)/$', 'ktit.storage.views.categorys.view'),
    (r'^category/colaps/(\d+)/$', 'ktit.storage.views.categorys.collaps'),
    (r'^category/expand/(\d+)/$', 'ktit.storage.views.categorys.expand'),
    (r'^category/add/$', 'ktit.storage.views.categorys.create'),
    (r'^category/edit/(\d+)/$', 'ktit.storage.views.categorys.edit'),
    (r'^category/delete/(\d+)/$', 'ktit.storage.views.categorys.delete'),

    #(r'^part/(\d+)/$', 'ktit.storage.views.parts.property'),
    (r'^part/add/$', 'ktit.storage.views.parts.create'),
    (r'^part/edit/(\d+)/$', 'ktit.storage.views.parts.edit'),
    (r'^part/delete/(\d+)/$', 'ktit.storage.views.parts.delete'),
    
    #(r'^recei/add/part/(\d+)/$', 'ktit.storage.views.documents.receipt_select_add_part'),
    
    (r'^receipt/select/part/(\d+)/$', 'ktit.storage.views.documents.document_receipt_select_or_new'),
    #(r'^receipt/(\d+)/part/(\d+)/$', 'ktit.storage.views.documents.receipt_add_part'),
    #(r'^delivery/(\d+)/part/(\d+)/$', 'ktit.storage.views.documents.document_delivery_add_part'),
    (r'^delivery/select/part/(\d+)/$', 'ktit.storage.views.documents.document_delivery_select_or_new'),
    (r'^delivery/select/part/(\d+)/serial/([^/]+)/$', 'ktit.storage.views.documents.document_delivery_select_or_new_serial'),
    (r'^delivery/(\d+)/part/(\d+)/serial/([^/]+)/$', 'ktit.storage.views.documents.document_delivery_add_serial'),
    
    #(r'^documents/$', 'ktit.storage.views.documents.document_open_list'),
    #(r'^documents/all/$', 'ktit.storage.views.documents.all'),
    #(r'^document/(\d+)/$', 'ktit.storage.views.documents.document_property'),
    (r'^document/edit/(\d+)/$', 'ktit.storage.views.documents.document_edit'),
    (r'^document/register/(\d+)/$', 'ktit.storage.views.documents.document_register'), 
)

#ktit.storage.views.documents
urlpatterns += patterns('ktit.storage.views.documents',
    url(r'^documents/$', 'document_open_list', name="doc_open"),
    url(r'^documents/all/$', 'all', name="doc_all"),
    url(r'^document/(\d+)/$', 'document_property', name="doc_property"),
    
    url(r'^receipt/add/(\d+)/$', 'receipt_add_part', name="receipt_add_part"),

    url(r'^delivery/add/(\d+)/$', 'document_delivery_add_part',  name="delivery_add_part"),

)    

#ktit.storage.views.parts
urlpatterns += patterns('ktit.storage.views.parts',
    url(r'^part/(\d+)/$', 'property', name="part_property"),
    url(r'^part/(\d+)/serials/$', 'serials', name="part_serial"),
) 

   